package com.car.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class JdbcUtil {
	public static String driverName = "oracle.jdbc.driver.OracleDriver";
	public static String url = "jdbc:oracle:thin:@localhost:1521:demo";
	public static String username = "shuangtixi";
	public static String password = "wangjie";
	
	public static Connection getConnection() throws ClassNotFoundException, SQLException {
		Class.forName(driverName);
		Connection con = DriverManager.getConnection(
				url,username,password);
		return con;
	}
	
	public static void closeConnection(Connection con, Statement st) throws SQLException {
		if (st != null) {
			st.close();
		}
		if (con != null) {
			con.close();
		}
	}
	
}
